package com.wechart.controller;

import com.wechart.dao.domain.Information;
import com.wechart.dao.domain.InformationCriteria;
import com.wechart.dao.mapper.InformationMapper;
import com.wechart.model.ChargeModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import java.math.BigDecimal;

/**
 * Created by silenceholic on 2017/7/10.
 */
@Controller
public class ChargeController {

    @Resource
    private InformationMapper informationMapper;

    @RequestMapping("slowCharge.htm")
    public ModelAndView slowCharge(@ModelAttribute ChargeModel chargeModel)
    {

        System.out.println("data"+chargeModel.getAmount());
        System.out.println("data"+chargeModel.getTel());
//        InformationCriteria criteria = new InformationCriteria();
//        criteria
        Information information = new Information();

        information.setTel(chargeModel.getTel());
        information.setAmount(new BigDecimal(chargeModel.getAmount()));
        informationMapper.insertSelective(information);
        return null;
    }
}
